Array.prototype.select = function (callback) {
  var result = [];
  this.forEach(item => {
    result.push(callback(item));
  })
  return result;
}
export default {
  isNullOrEmpty (input) {
    return input === undefined || input === null || input === ''
  },
  DateCompare (a, b) {
    var dateA = new Date(a)
    var dateB = new Date(b)
    if (isNaN(dateA) || isNaN(dateB)) {
      throw new Error('Input datetime format is not valid')
    }
    return dateA.getTime() - dateB.getTime() > 0
  },
  DateFormat (timeStamp) {
    var date = new Date(timeStamp)
    var DATE = date.getDate() < 10 ? '0' + date.getDate() : date.getDate()
    var MONTH = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : (date.getMonth() + 1)
    var HOUR = date.getHours() < 10 ? '0' + date.getHours() : date.getHours()
    var MINUTE = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()
    var SECOND = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds()
    return date.getFullYear() + '-' + MONTH + '-' + DATE + ' ' + HOUR + ':' + MINUTE + ':' + SECOND
  }
}
